package com.sb.money.dao;

import java.io.Serializable;
import java.util.List;

import org.apache.tapestry5.hibernate.annotations.CommitAfter;

/**
 * Abstract Dao base interface prescribing the methods which must be implemented
 * in the DaoBaseImpl class, and other child classes. Providing CRUD.
 * 
 * @author Stefan Bertos
 * @param <E>
 *            entity to substitute.
 * 
 */
public abstract interface AbstractDao<E extends Serializable> {

    /**
     * @param entity
     *            to add
     * @return generated id
     * 
     */
    @CommitAfter
    E create(E entity);

    /**
     * @param entity
     *            to update
     */
    @CommitAfter
    void update(E entity);

    /**
     * @param entity
     *            to delete
     */
    @CommitAfter
    void delete(E entity);

    /**
     * @return List of entitities
     * 
     */
    List<E> findAll();
}